<!-- 回掉值为已经定义好的methods -->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/vue.js"></script>
</head>

<body>
    <div id="app">
        {{msg}}
        <br>
        <input type="text" v-model="msg">
    </div>
    <script>
        var vm = new Vue({
            el: '#app',
            data: {
                msg: "hello vue"
            },
            computed: {

            },
            methods: {
                watchMsg: function (newValue, oldValue) {
                    console.log(`新值：${newValue} ; 新值：${oldValue}`)
                }
            },
            watch: {
                msg: 'watchMsg'
            }
        })
    </script>
</body>

</html>